package com.sgb.kjwl.view.widget.manage;

import android.content.Context;
import android.content.Intent;

import com.sgb.knowledgeshare.view.activity.PlayListActivity;
import com.sgb.kjwl.view.widget.self.MenuClickUtils;
import com.swgk.core.base.model.entity.VideoBean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

//网站操作工具类
public class WebsiteUtils {

    private WebsiteUtils(){

    }

    private static volatile WebsiteUtils mWebsiteUtils;


    public static WebsiteUtils getInstance(){
        try {
            if (mWebsiteUtils == null){
                synchronized (MenuClickUtils.class){
                    mWebsiteUtils = new WebsiteUtils();
                }
            }
        } catch (Exception e){

        }
        return mWebsiteUtils;
    }

    //跳转到视频播放
    /**
     * @param context
     * @param video  视频id
     * @param videoUrl 视频url
     * @param coverUrl 视频封面
     */
    public void openVideo(Context context, String video, String videoUrl, String coverUrl){
        List<VideoBean> videoBeanList = new ArrayList<>();
        VideoBean videoBean = new VideoBean();
        videoBean.setVideoId(video);
        videoBean.setCoverURL(videoUrl);
        videoBean.setCover(coverUrl);
        videoBeanList.add(videoBean);
        Intent intent = new Intent(context, PlayListActivity.class);
        intent.putExtra(PlayListActivity.VIDEOLISTBEAN, (Serializable) videoBeanList);
        intent.putExtra(PlayListActivity.PSO, 0);
        intent.putExtra(PlayListActivity.IS_ShOW_USER, false);
        intent.putExtra(PlayListActivity.VIDEOTYPE, "website_video");
        context.startActivity(intent);
    }
}
